<template>
  <div class="inject3">
    <h1>这里是最小的组件儿子组件</h1>
    <h4>资产：{{ money }}</h4>
    <h4>汽车：{{ car }}</h4>
    <button @click="updateMoney(6)">点我</button>
  </div>
</template>
<script lang="ts" setup>
import { inject } from "vue";
// 注入数据
let { money, updateMoney } = inject("moneyContext", {
  money: 0,
  updateMoney: (x: number) => {},
});
let car = inject("car");
</script>
<style scoped>
.inject3 {
  width: 80vw;
  height: 80vh;
  border: 1px solid red;
}
</style>